Skip to content

Hw 2 Кожуро Б Е#2

Open
BorisKoz wants to merge 25 commits intomasterfrom
HW-2
Open

Hw 2 Кожуро Б Е#2
BorisKoz wants to merge 25 commits intomasterfrom
HW-2

Conversation

@BorisKoz
Copy link
Copy Markdown
Owner

pull for HW-2

@BorisKoz
Copy link
Copy Markdown
Owner Author

BorisKoz commented Apr 1, 2021

Работа Кожуро Б Е

@BorisKoz BorisKoz changed the title Hw 2 Hw 2 Кожуро Б Е Apr 1, 2021
Copy link
Copy Markdown
Collaborator

@IlyaSaneev IlyaSaneev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Добавить результаты работы последовательного и параллельного алгоритма
  2. Добавить использование динамической загрузки библиотеки, методы dlopen/dlsym
  3. Нет приемов по оптимизации работы с кеш-памятью

Comment on lines +96 to +97
pthread_mutex_t mutex_write_lock;
pthread_mutex_init(&mutex_write_lock, NULL);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

убрать, параллельная работа должна быть реализована без использования мьютексов


// this is parent process block
for (int i = 0; i < process_count; i++) {
waitpid(processes[i], NULL, 0);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://linux.die.net/man/2/waitpid
добавить проверку возвращаемого значения и статуса

file_search(&f1, c1, found, stf);
fclose(f1);
remove("1.txt");
ASSERT_EQ(found[0], 4);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему ASSERT, а не EXPECT?

// считывание символов
int size_to_find = 0;
char to_find[BUFFER_SIZE] = "";
size_t found[BUFFER_SIZE] = {0};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{0} это уже нулевая инициализация

Comment on lines +112 to +130
for (int j = 0; j < size_to_find; j++) {
int count = 0;
for (size_t i = divisions[current_id];
i < divisions[current_id+1]; i++) {
if (file_in_memory[i] == to_find[j])
count++;
}
char str[BUFFER_SIZE] = "0";
snprintf(str, READ_SIZE + 1, FORMAT_STRING, count);
write(pipes[current_id][1], str, strlen(str));
}
char* end_sig = malloc(sizeof(char));
read(pipes[current_id][0], end_sig, sizeof(char));
close(pipes[current_id][0]);
close(pipes[current_id][1]);
free_all_resources(divisions, processes);
free(end_sig);
fclose(*fp);
exit(0);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вынести в функцию

return getpid();
}

int file_search(FILE** fp, const char* to_find,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Стоит реализовать параллельный алгоритм через последовательный

@IlyaSaneev IlyaSaneev removed their assignment Apr 1, 2021
@codecov-io
Copy link
Copy Markdown

codecov-io commented Apr 1, 2021

Codecov Report

❗ No coverage uploaded for pull request base (master@80e247a). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 4d61da2 differs from pull request most recent head eb2326d. Consider uploading reports for the commit eb2326d to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##             master       #2   +/-   ##
=========================================
  Coverage          ?   92.54%           
=========================================
  Files             ?        6           
  Lines             ?      228           
  Branches          ?        0           
=========================================
  Hits              ?      211           
  Misses            ?       17           
  Partials          ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 80e247a...eb2326d. Read the comment docs.

@IlyaSaneev
Copy link
Copy Markdown
Collaborator

зачет

@IlyaSaneev IlyaSaneev removed their assignment Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants